home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / programr / vbasic / vbprint.exe / TESTAPP.FRM < prev    next >
Text File  |  1993-07-22  |  11KB  |  380 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Print Control Test Application"
  6.    ClientHeight    =   4965
  7.    ClientLeft      =   1470
  8.    ClientTop       =   1890
  9.    ClientWidth     =   9105
  10.    FontBold        =   -1  'True
  11.    FontItalic      =   -1  'True
  12.    FontName        =   "MS Sans Serif"
  13.    FontSize        =   8.25
  14.    FontStrikethru  =   0   'False
  15.    FontUnderline   =   0   'False
  16.    Height          =   5370
  17.    Icon            =   TESTAPP.FRX:0000
  18.    Left            =   1410
  19.    LinkMode        =   1  'Source
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    ScaleHeight     =   4965
  23.    ScaleWidth      =   9105
  24.    Top             =   1545
  25.    Width           =   9225
  26.    Begin CommandButton Command2 
  27.       BackColor       =   &H00C0C0C0&
  28.       Caption         =   "&About..."
  29.       Height          =   375
  30.       Left            =   7560
  31.       TabIndex        =   14
  32.       Top             =   3960
  33.       Width           =   1455
  34.    End
  35.    Begin CommandButton Command1 
  36.       BackColor       =   &H00C0C0C0&
  37.       Caption         =   "E&xit"
  38.       Height          =   375
  39.       Left            =   7560
  40.       TabIndex        =   13
  41.       Top             =   4440
  42.       Width           =   1455
  43.    End
  44.    Begin CommandButton TestColumn 
  45.       BackColor       =   &H00C0C0C0&
  46.       Caption         =   "Test &Column Output"
  47.       Height          =   375
  48.       Left            =   120
  49.       TabIndex        =   3
  50.       Top             =   2520
  51.       Width           =   1935
  52.    End
  53.    Begin TextBox CompanyName 
  54.       BackColor       =   &H00FFFFFF&
  55.       ForeColor       =   &H00000000&
  56.       Height          =   375
  57.       Left            =   2280
  58.       TabIndex        =   4
  59.       Top             =   2760
  60.       Width           =   6615
  61.    End
  62.    Begin TextBox TestText 
  63.       BackColor       =   &H00FFFFFF&
  64.       ForeColor       =   &H00000000&
  65.       Height          =   1695
  66.       Left            =   2280
  67.       MultiLine       =   -1  'True
  68.       ScrollBars      =   3  'Both
  69.       TabIndex        =   2
  70.       Top             =   720
  71.       Width           =   6615
  72.    End
  73.    Begin CommandButton TextTest 
  74.       BackColor       =   &H00C0C0C0&
  75.       Caption         =   "Test &Text Output"
  76.       Height          =   375
  77.       Left            =   120
  78.       TabIndex        =   1
  79.       Top             =   720
  80.       Width           =   1935
  81.    End
  82.    Begin CommandButton GraphicsTest 
  83.       BackColor       =   &H00C0C0C0&
  84.       Caption         =   "Test &Graphics"
  85.       Height          =   375
  86.       Left            =   105
  87.       TabIndex        =   0
  88.       Top             =   240
  89.       Width           =   1935
  90.    End
  91.    Begin Label PrintPort 
  92.       BackColor       =   &H00C0C0C0&
  93.       FontBold        =   0   'False
  94.       FontItalic      =   0   'False
  95.       FontName        =   "MS Sans Serif"
  96.       FontSize        =   8.25
  97.       FontStrikethru  =   0   'False
  98.       FontUnderline   =   0   'False
  99.       Height          =   255
  100.       Left            =   1680
  101.       TabIndex        =   12
  102.       Top             =   4320
  103.       Width           =   3735
  104.    End
  105.    Begin Label Label5 
  106.       BackColor       =   &H00C0C0C0&
  107.       Caption         =   "Port Name:"
  108.       Height          =   255
  109.       Left            =   120
  110.       TabIndex        =   11
  111.       Top             =   4320
  112.       Width           =   1455
  113.    End
  114.    Begin Label PrintName 
  115.       BackColor       =   &H00C0C0C0&
  116.       FontBold        =   0   'False
  117.       FontItalic      =   0   'False
  118.       FontName        =   "MS Sans Serif"
  119.       FontSize        =   8.25
  120.       FontStrikethru  =   0   'False
  121.       FontUnderline   =   0   'False
  122.       Height          =   255
  123.       Left            =   1680
  124.       TabIndex        =   10
  125.       Top             =   4080
  126.       Width           =   3735
  127.    End
  128.    Begin Label Label4 
  129.       BackColor       =   &H00C0C0C0&
  130.       Caption         =   "Printer Name:"
  131.       Height          =   255
  132.       Left            =   120
  133.       TabIndex        =   9
  134.       Top             =   4080
  135.       Width           =   1455
  136.    End
  137.    Begin Label DLLVersion 
  138.       BackColor       =   &H00C0C0C0&
  139.       FontBold        =   0   'False
  140.       FontItalic      =   0   'False
  141.       FontName        =   "MS Sans Serif"
  142.       FontSize        =   8.25
  143.       FontStrikethru  =   0   'False
  144.       FontUnderline   =   0   'False
  145.       Height          =   255
  146.       Left            =   1680
  147.       TabIndex        =   8
  148.       Top             =   3840
  149.       Width           =   3735
  150.    End
  151.    Begin Label Label3 
  152.       BackColor       =   &H00C0C0C0&
  153.       Caption         =   "DLL Version:"
  154.       Height          =   255
  155.       Left            =   120
  156.       TabIndex        =   7
  157.       Top             =   3840
  158.       Width           =   1455
  159.    End
  160.    Begin Line Line2 
  161.       BorderWidth     =   4
  162.       X1              =   120
  163.       X2              =   9000
  164.       Y1              =   3720
  165.       Y2              =   3720
  166.    End
  167.    Begin Label Label2 
  168.       BackColor       =   &H00C0C0C0&
  169.       Caption         =   "Printer Information:"
  170.       FontBold        =   -1  'True
  171.       FontItalic      =   0   'False
  172.       FontName        =   "MS Sans Serif"
  173.       FontSize        =   12
  174.       FontStrikethru  =   0   'False
  175.       FontUnderline   =   0   'False
  176.       Height          =   330
  177.       Left            =   120
  178.       TabIndex        =   6
  179.       Top             =   3360
  180.       Width           =   6210
  181.    End
  182.    Begin Shape Shape2 
  183.       BorderColor     =   &H0000FFFF&
  184.       BorderWidth     =   3
  185.       Height          =   375
  186.       Left            =   6405
  187.       Top             =   210
  188.       Width           =   1335
  189.    End
  190.    Begin Shape Shape1 
  191.       BorderColor     =   &H00FF0000&
  192.       BorderWidth     =   3
  193.       Height          =   375
  194.       Left            =   4320
  195.       Shape           =   2  'Oval
  196.       Top             =   210
  197.       Width           =   1575
  198.    End
  199.    Begin Line Line1 
  200.       BorderColor     =   &H000000FF&
  201.       BorderWidth     =   3
  202.       X1              =   2280
  203.       X2              =   3960
  204.       Y1              =   210
  205.       Y2              =   480
  206.    End
  207.    Begin Label Label1 
  208.       BackColor       =   &H00C0C0C0&
  209.       Caption         =   "Your Name Here:"
  210.       ForeColor       =   &H00000000&
  211.       Height          =   255
  212.       Left            =   2280
  213.       TabIndex        =   5
  214.       Top             =   2520
  215.       Width           =   2535
  216.    End
  217. End
  218. Sub Command1_Click ()
  219.     End
  220. End Sub
  221.  
  222. Sub Command2_Click ()
  223.    AboutBox.Show 1
  224. End Sub
  225.  
  226. Sub Form_Load ()
  227.     Dim nMajor As Integer
  228.     Dim nMinor As Integer
  229.     
  230.     i% = PrintDLLVersion()
  231.     
  232.     nMajor = i% And 255
  233.     nMinor = (i% And 65280) / 256
  234.     
  235.     DLLVersion.Caption = Str$(nMajor) + "." + Str$(nMinor)
  236.  
  237.     DevName$ = String$(255, 0)
  238.     i% = PrinterPort(DevName$)
  239.     PrintPort.Caption = DevName$
  240.  
  241.     DevName$ = String$(255, 0)
  242.     i% = PrinterName(DevName$)
  243.     PrintName.Caption = DevName$
  244.     
  245. End Sub
  246.  
  247. Sub Form_Unload (Cancel As Integer)
  248.     End
  249. End Sub
  250.  
  251. Sub GraphicsTest_Click ()
  252.     
  253.     Dim i As Integer
  254.     Dim Marg As Integer
  255.  
  256.     PrintingDlg.Show
  257.  
  258.     i% = InitializePrinter(Main.hWnd)
  259.     
  260.     i% = PageLayoutSetup(100, 100, 100, 100)
  261.     
  262.     i% = DrawLine(5000, 5000, 10080, 10080)
  263.     i% = DrawRectangle(4450, 7000, 8000, 13000)
  264.     i% = DrawEllipse(5000, 5000, 7000, 8000)
  265.     i% = DrawRndRectangle(2000, 2000, 3000, 15000, 2000, 2000)
  266.  
  267.     i% = DonePrinting()
  268.  
  269.     PrintingDlg.Hide
  270.  
  271. End Sub
  272.  
  273. Sub TestColumn_Click ()
  274.     Dim nStyle As Integer
  275.     Dim i As Integer
  276.     Dim rgColumnWidths() As Integer
  277.     Dim szHeader As String
  278.  
  279.     ReDim rgColumnWidths(1 To 8)
  280.     
  281.     PrintingDlg.Show
  282.     
  283.     i% = InitializePrinter(Main.hWnd)
  284.  
  285.     szText$ = CompanyName.Text
  286.     rgColumnWidths(1) = 150
  287.     rgColumnWidths(2) = 300
  288.     nStyle = 60
  289.     szHeader$ = "Company Name:" + Chr$(9) + szText$
  290.     i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
  291.     szHeader$ = "Address:" + Chr$(9) + "12345 Elm Street"
  292.     i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
  293.     szHeader$ = " " + Chr$(9) + "Anywhere, USA"
  294.     i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
  295.     szHeader$ = "Date:" + Chr$(9) + Date$
  296.     i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
  297.  
  298.     i% = MoveYPos(100)
  299.  
  300.     rgColumnWidths(1) = 100
  301.     rgColumnWidths(2) = 400
  302.     rgColumnWidths(3) = 100
  303.  
  304.     nStyle = 32
  305.     szHeader$ = "Quantity" + Chr$(9) + "Description" + Chr$(9) + "Price"
  306.     i% = PrintColumnHeaders(szHeader$, 3, rgColumnWidths(1), "Arial", 18, nStyle%)
  307.  
  308.     nStyle = 0
  309.  
  310.     i% = SetUpColumns(3, rgColumnWidths(1), "Courier New", 12, nStyle%)
  311.     
  312.     i% = PrintColumnText("6" + Chr$(9) + "Computer 486sx 25Mhz" + Chr$(9) + "$ 3250.54")
  313.     i% = PrintColumnText("2" + Chr$(9) + "This is a very long description that shows the ability to wrap text" + Chr$(9) + "$   34.64")
  314.     i% = PrintColumnText("1" + Chr$(9) + "Generic Modem" + Chr$(9) + "$  145.32")
  315.     i% = PrintColumnText("3" + Chr$(9) + "Gross of Fire Crackers " + Chr$(9) + "$    1.92")
  316.     
  317.     i% = EndColumnPrinting()
  318.     
  319.     i% = DonePrinting()
  320.  
  321.     PrintingDlg.Hide
  322.  
  323. End Sub
  324.  
  325. Sub TextTest_Click ()
  326.     
  327.     Dim nStyle As Integer
  328.     Dim i As Integer
  329.     Dim Marg As Integer
  330.  
  331.     PrintingDlg.Show
  332.  
  333.     i% = InitializePrinter(Main.hWnd)
  334.  
  335.     i% = PageLayoutSetup(100, 100, 100, 100)
  336.  
  337.     ' Print it Once
  338.  
  339.     nStyle = 0
  340.     
  341.     i% = StartParagraph("Times New Roman", 12, nStyle%)
  342.  
  343.     szText$ = TestText.Text
  344.     i% = ParagraphText(szText$)
  345.  
  346.     i% = FinishParagraph()
  347.  
  348.     i% = SetParagraphSpacing(36, 18)
  349.  
  350.     ' Print it Twice
  351.  
  352.     nStyle = 60
  353.     
  354.     i% = StartParagraph("Arial", 18, nStyle%)
  355.  
  356.     szText$ = TestText.Text
  357.     i% = ParagraphText(szText$)
  358.  
  359.     i% = FinishParagraph()
  360.  
  361.     i% = SetParagraphSpacing(8, 18)
  362.  
  363.     ' Print it a Third time
  364.  
  365.     nStyle = 0
  366.     
  367.     i% = StartParagraph("Courier New", 8, nStyle%)
  368.  
  369.     szText$ = TestText.Text
  370.     i% = ParagraphText(szText$)
  371.  
  372.     i% = FinishParagraph()
  373.  
  374.     i% = DonePrinting()
  375.  
  376.     PrintingDlg.Hide
  377.  
  378. End Sub
  379.  
  380.